﻿
Imports xmlctrl
Imports xhtmlctrl
Imports wfileis.data

Public Class idshow
    Inherits container

    Public Sub setData(ByVal info As info, Optional ByVal prefix As String = Nothing)
        If info Is Nothing Then
            setData(convertor.cast(Of String)(Nothing), prefix)
        Else
            setData(info.id(), prefix)
        End If
    End Sub

    Private Function createText(ByVal id As String, ByVal prefix As String) As String
        If isemptystring(prefix) Then
            Return id
        Else
            Return prefix + character.blank + id
        End If
    End Function

    Public Sub setData(ByVal id As String, Optional ByVal prefix As String = Nothing)
        Dim context As httpContext = Nothing
        context = httpServer2.currentContext()
        If Not isemptystring(id) Then
            Dim a As a = Nothing
            a = context.createControl(New a())
            a.text = createText(id, prefix)
            a.href = user.generateUserViewlink(context, id)
            addchild(a)
        Else
            Dim s As span = Nothing
            s = context.createControl(New span())
            s.text = createText(context.string(stringId.INFO_NOID), prefix)
            addchild(s)
        End If
    End Sub
End Class
